Skip to content

Instantly share code, notes, and snippets.

@devsli
devsli / install_pptp_client_ubuntu.sh
Last active September 6, 2019 12:59 — forked from beherca/install_pptp_client_ubuntu.sh
Install PPTP Client on Ubuntu
#!/bin/bash
# For detail introduction, please see http://www.jamescoyle.net/how-to/963-set-up-linux-pptp-client-from-the-terminal
# exit when error occur
set -o errexit
set -o nounset
# Bash will remember & return the highest exitcode in a chain of pipes.
# This way you can catch the error in case mysqldump fails in `mysqldump |gzip`
set -o pipefail
import React from 'react';
import PropTypes from 'prop-types';
import RangeCalendar from 'rc-calendar/lib/RangeCalendar';
import classnames from 'classnames';
import CalendarPart from 'rc-calendar/lib/range-calendar/CalendarPart';
import TodayButton from 'rc-calendar/lib/calendar/TodayButton';
import OkButton from 'rc-calendar/lib/calendar/OkButton';
import TimePickerButton from 'rc-calendar/lib/calendar/TimePickerButton';
import { getTodayTime, isAllowedDate } from 'rc-calendar/lib/util/';
@devsli
devsli / tryhard
Last active September 10, 2019 07:29
Repeat command until it completes successfully
#!/bin/sh
while ! "$@"
do
echo Retry in 5 sec...
sleep 5
done
@devsli
devsli / rollpaper.sh
Last active December 2, 2016 10:45
Random wallpaper every half an hour
#!/bin/sh
export DISPLAY=${DISPLAY:-:0}
while true
do
feh --bg-scale --randomize ~/Images/Wallpapers
sleep 1800
done
@devsli
devsli / careful-stroke.scm
Created September 10, 2016 19:48
GIMP: Careful stroke
(define (script-fu-stroke image drawable selection-grow-steps)
(let* (
(selected-layer (car (gimp-image-get-active-layer image)))
(width (car (gimp-image-width image)))
(height (car (gimp-image-height image)))
(image-mode 1)
(stroke-layer-name "Stroke")
(stroke-opacity 100)
(overlay-mode NORMAL-MODE)
(stroke-layer (car (gimp-layer-new image width height image-mode stroke-layer-name stroke-opacity overlay-mode)))
@devsli
devsli / put-in-bubble.scm
Created September 10, 2016 19:46
GIMP: Put text in bubble script
(define (script-fu-bubble image drawable tail-length tail-offset tail-width)
(let* (
(selected-layer (car (gimp-image-get-active-layer image)))
(width (car (gimp-image-width image)))
(height (car (gimp-image-height image)))
(image-mode 1)
(bubble-layer-name "Bubble")
(bubble-opacity 100)
(overlay-mode NORMAL-MODE)
(bubble-layer (car (gimp-layer-new image width height image-mode bubble-layer-name bubble-opacity overlay-mode)))
@devsli
devsli / keybase.md
Created July 29, 2016 19:00
keybase.md

Keybase proof

I hereby claim:

  • I am devsli on github.
  • I am unpunk (https://keybase.io/unpunk) on keybase.
  • I have a public key whose fingerprint is E215 B8D1 1A92 A994 593F 53C2 634D FB12 8626 D6FF

To claim this, I am signing this object:

@devsli
devsli / gist:75ea21bbc8333c5bfe6a8ef8030861ab
Last active August 26, 2019 12:43
Test uploads with big file
# 1. Create big file
# ------------------
# If the number ends with a ``b'', ``k'', ``m'', ``g'', or ``w'',
# the number is multiplied by 512, 1024 (1K), 1048576 (1M), 1073741824 (1G)
# or the number of bytes in an integer, respectively.
# Two or more numbers may be separated by an ``x'' to indicate a product.
fallocate -l 512m my-big-file
# 2. Upload big file
@devsli
devsli / README.rst
Last active March 13, 2016 14:26
py.test SMTPd fixture

Secure SMTPd py.test fixture

Test outgoing messages of your app.

It's possible to replace secure-smtpd with default smtpd if AUTH is not forced by your application.

@devsli
devsli / testch.sh
Last active August 29, 2015 14:12
OpenWRT WiFi channel checker
#!/bin/sh
CURRENT=$(uci get wireless.radio0.channel)
HOST=$(echo $SSH_CONNECTION | awk '{print $1}') # host to ping
echo "Initial channel: $CURRENT"
set_channel()
{
uci set wireless.radio0.channel=$1