Skip to content

Instantly share code, notes, and snippets.

View gist:91210da7b9b010b8552244d3072ac919
Feb 18 13:22:57 Charlie18c lightdm[2292]: pam_unix(lightdm:session): session opened for user cgorichanaz by (uid=0)
Feb 18 13:22:57 Charlie18c gnome-keyring-daemon[2299]: The gnome-keyring control directory cannot be accessed: /run/user/0/keyring: Permission denied
Feb 18 13:22:57 Charlie18c kernel: audit: type=1112 audit(1550524977.942:116): pid=2292 uid=0 auid=1000 ses=3 msg='op=login id=1000 exe="/usr/bin/lightdm" hostname=Charlie18c addr=? terminal=/dev/tty7 res=success'
Feb 18 13:22:57 Charlie18c audit[2292]: USER_LOGIN pid=2292 uid=0 auid=1000 ses=3 msg='op=login id=1000 exe="/usr/bin/lightdm" hostname=Charlie18c addr=? terminal=/dev/tty7 res=success'
Feb 18 13:22:57 Charlie18c gnome-keyring-daemon[2299]: couldn't create socket directory: /run/user/0/keyring-4TB7WZ: Permission denied
Feb 18 13:22:57 Charlie18c gnome-keyring-daemon[2299]: couldn't bind to control socket: /run/user/0/keyring-4TB7WZ/control: Permission denied
View gist:129968fe9c952b6c7deafe20e3376897
$ aurman -S uacpid
~~ initializing aurman...
:: Ignoring installed package insync
~~ calculating solutions...
:: The following 11 package(s) are getting installed:
community/cabal-install / -> 2.4.0.0-46
community/ghc / -> 8.6.3-1
community/haskell-base16-bytestring / -> 0.1.1.6-12
community/haskell-cryptohash-sha256 / -> 0.11.101.0-7
@CNG
CNG / kill_unresponsive.scpt
Created Nov 1, 2017
Kill unresponsive app
View kill_unresponsive.scpt
tell application "Activity Monitor" to run --We need to run Activity Monitor
tell application "System Events" to tell process "Activity Monitor"
tell radio button 1 of radio group 1 of group 2 of toolbar 1 of window 1 to click --Using the CPU View
tell outline 1 of scroll area 1 of window 1 -- working with the list
set notResponding to rows whose value of first static text contains "Insync (Not Responding)" -- Looking for Not responding process
repeat with aProcess in notResponding
set pid to value of text field 5 of aProcess -- For each non responding process retrieve the PID
if pid is not "" then do shell script ("kill -9 " & pid) -- KILL the PID.
end repeat
end tell
View .py
# my solution:
def make_change(coins, n):
coins = list(coins)
if 'D' not in make_change.__dict__:
make_change.D = {}
id = tuple(coins), n
if id not in make_change.D:
coin = coins.pop(0)
make_change.D[id] = sum(make_change(list(coins), n-i*coin) for i in range(n//coin+1)) if coins else int(n % coin == 0)
View alphabet-rangoli.py
def print_rangoli(size):
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz' # from string import ascii_lowercase
width = size*4-3
chars = ascii_lowercase[:size]
#for line in range(1,size+1):
# line_chars = chars[size-1:size-line:-1] + chars[-line:]
# print(('-'.join(line_chars)).center(width, '-'))
#for line in reversed(range(1,size)):
# line_chars = chars[size-1:size-line:-1] + chars[-line:]
View gist:1ada1dc0493d3d6d3055a14ed5be6fc2
2017-04-22 01:43:03 execCom:executing: "/system/bin/id"
2017-04-22 01:43:03 execCom::stdout result: uid=10058(u0_a58) gid=10058(u0_a58) groups=10058(u0_a58),3002(net_bt),3003(inet),9997(everybody),50058(all_a58) context=u:r:untrusted_app:s0:c512,c768
2017-04-22 01:43:03 execCom::exit value: true
2017-04-22 01:43:03 generateNewKey:Check: dsa key is present.
2017-04-22 01:43:03 generateNewKey:Check: rsa key is present.
2017-04-22 01:43:03 generateNewKey:Check: ecdsa key is present.
2017-04-22 01:43:03 execCom:executing: "bin/pidof","sshelper_sshd","ssh"
2017-04-22 01:43:03 execCom::exit value: false
2017-04-22 01:43:03 LogServer: restarting server on port: 8080
2017-04-22 01:43:03 ClipboardServer: restarting server on port: 8081
View gist:63daf3ee3812fd6da14170bf98b3ebac
2017-04-22 01:18:56 execCom:executing: "/system/bin/id"
2017-04-22 01:18:56 execCom::stdout result: uid=10058(u0_a58) gid=10058(u0_a58) groups=10058(u0_a58),3002(net_bt),3003(inet),9997(everybody),50058(all_a58) context=u:r:untrusted_app:s0:c512,c768
2017-04-22 01:18:56 execCom::exit value: true
2017-04-22 01:18:56 generateNewKey:Check: dsa key is present.
2017-04-22 01:18:56 generateNewKey:Check: rsa key is present.
2017-04-22 01:18:56 generateNewKey:Check: ecdsa key is present.
2017-04-22 01:18:56 execCom:executing: "bin/pidof","sshelper_sshd","ssh"
2017-04-22 01:18:56 execCom::exit value: false
2017-04-22 01:18:56 ClipboardServer: restarting server on port: 8081
2017-04-22 01:18:56 LogServer: restarting server on port: 8080
View .sh
2017-04-22 00:30:46 execCom:executing: "/system/bin/id"
2017-04-22 00:30:46 execCom::stdout result: uid=10058(u0_a58) gid=10058(u0_a58) groups=10058(u0_a58),3002(net_bt),3003(inet),9997(everybody),50058(all_a58) context=u:r:untrusted_app:s0:c512,c768
2017-04-22 00:30:46 execCom::exit value: true
2017-04-22 00:30:46 generateNewKey:Check: dsa key is present.
2017-04-22 00:30:46 generateNewKey:Check: rsa key is present.
2017-04-22 00:30:46 generateNewKey:Check: ecdsa key is present.
2017-04-22 00:30:46 execCom:executing: "bin/pidof","sshelper_sshd","ssh"
2017-04-22 00:30:46 execCom::exit value: false
2017-04-22 00:30:46 LogServer: restarting server on port: 8080
2017-04-22 00:30:46 ClipboardServer: restarting server on port: 8081
@CNG
CNG / gist:436264df4bff6d99208d67ce1f42a2c5
Created Apr 12, 2017
Socket listen to failed SSH connection (Protocol mismatch) over ADB forwarded socket to Android
View gist:436264df4bff6d99208d67ce1f42a2c5
➜ ~ sudo mv /var/folders/jk/3fltf9vx0n15p2qhkpjx2zk80000gn/T/adb-channel.O3qvO2/sock /var/folders/jk/3fltf9vx0n15p2qhkpjx2zk80000gn/T/adb-channel.O3qvO2/sock.original
sudo socat -t100 -x -v UNIX-LISTEN:/var/folders/jk/3fltf9vx0n15p2qhkpjx2zk80000gn/T/adb-channel.O3qvO2/sock,mode=777,reuseaddr,fork UNIX-CONNECT:/var/folders/jk/3fltf9vx0n15p2qhkpjx2zk80000gn/T/adb-channel.O3qvO2/sock.original
< 2017/04/12 03:20:06.995969 length=21 from=0 to=20
53 53 48 2d 32 2e 30 2d 4f 70 65 6e 53 53 48 5f SSH-2.0-OpenSSH_
37 2e 31 0d 0a 7.1..
--
> 2017/04/12 03:20:07.014937 length=1432 from=0 to=1431
00 00 05 94 0b 14 08 12 e0 64 0b 32 7c d3 0d ce .........d.2|...
42 da 73 55 13 46 00 00 01 30 63 75 72 76 65 32 B.sU.F...0curve2
@CNG
CNG / gist:afd970322a1a5d8c85fddecc3ff3e232
Created Apr 12, 2017
TCPDump of SSH connection over ADB forwarded port to Android
View gist:afd970322a1a5d8c85fddecc3ff3e232
➜ ~ sudo tcpdump -i any -nNvXS port 2224
tcpdump: data link type PKTAP
tcpdump: listening on any, link-type PKTAP (Apple DLT_PKTAP), capture size 262144 bytes
03:57:35.194103 IP6 (flowlabel 0x02af8, hlim 64, next-header TCP (6) payload length: 44) ::1.53458 > ::1.2224: Flags [SEW], cksum 0x0034 (incorrect -> 0x1f6a), seq 857046338, win 65535, options [mss 16324,nop,wscale 5,nop,nop,TS val 717826078 ecr 0,sackOK,eol], length 0
0x0000: 1e00 0000 6000 2af8 002c 0640 0000 0000 ....`.*..,.@....
0x0010: 0000 0000 0000 0000 0000 0001 0000 0000 ................
0x0020: 0000 0000 0000 0000 0000 0001 d0d2 08b0 ................
0x0030: 3315 7d42 0000 0000 b0c2 ffff 0034 0000 3.}B.........4..
0x0040: 0204 3fc4 0103 0305 0101 080a 2ac9 281e ..?.........*.(.
0x0050: 0000 0000 0402 0000 ........