Skip to content

Instantly share code, notes, and snippets.

@CNG
CNG / .sh
Last active June 17, 2020 23:48
Fix special characters in filenames on FS and in WP DB
hostname=
username=
database=
password=
cd /var/www/html/wp-content/uploads
export MYSQL_PWD=$password
MYSQL_CONN="mysql -B -h$hostname -u$username $database --disable-column-names"
@CNG
CNG / gist:edd8f6210caede7a7f8e
Created June 16, 2014 06:16
Japanese katakana and hiragana in plain text
Katakana Codes
ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴヵヶヷヸヹヺ・
Punctuation and Symbols
゛゜ーヽヾ
Phonetic Extensions for Ainu
ㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ
Circle Forms
@CNG
CNG / gist:91210da7b9b010b8552244d3072ac919
Created February 18, 2019 21:34
gnome-keyring-daemon
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
@CNG
CNG / gist:129968fe9c952b6c7deafe20e3376897
Created February 18, 2019 02:51
uacpid install failure
$ 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 November 1, 2017 06:23
Kill unresponsive app
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
# 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)
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:]
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
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
@CNG
CNG / .sh
Created April 22, 2017 07:33
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