Skip to content

Instantly share code, notes, and snippets.

View delphym's full-sized avatar
🏠
Studying WB DEVELOPMENT with Dev Academy

DelphyM delphym

🏠
Studying WB DEVELOPMENT with Dev Academy
  • Christchurch, NZ
  • 11:38 (UTC -12:00)
View GitHub Profile
@delphym
delphym / jenkins-home-git.sh
Last active June 28, 2018 08:49 — forked from cenkalti/jenkins-home-git.sh
Backup Jenkins home periodicallly with git.
#!/bin/bash
# Script origin @ https://gist.github.com/delphym/687927bf521f598714e27804304ceca4
# Setup
#
# - Create a new Jenkins Job
# - Mark "None" for Source Control Management
# - Select the "Build Periodically" build trigger
# - configure to run as frequently as you like
# - Add a new "Execute Shell" build step
@delphym
delphym / clean.sh
Last active February 25, 2021 16:49 — forked from Iman/clean.sh
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/bin/sh
# source of the script can be found at: https://gist.github.com/ad3bbd9d5cafea47bfd66367a0a8cdb6.git
#Check the space on the computer before clean up
df -h
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
@delphym
delphym / HDD_cloning.sh
Last active November 7, 2018 01:50
Some handy shell and bash scripts for backups and other system maintanance
#!/bin/sh
sudo fdisk /dev/sdb -l
#Disk /dev/sdb: 477 GiB, 512110190592 bytes, 1000215216 sectors
#Units: sectors of 1 * 512 = 512 bytes
#Sector size (logical/physical): 512 bytes / 512 bytes
#I/O size (minimum/optimal): 512 bytes / 512 bytes
#Disklabel type: gpt
#Disk identifier: 04361FB4-3666-4BD1-8D46-6609C315D81B
#Device Start End Sectors Size Type
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console\C:_Program Files_WindowsApps_CanonicalGroupLimited.UbuntuonWindows_1604.2018.510.0_x64__79rhkp1fndgsc_ubuntu.exe]
"ColorTable00"=dword:00312700
"ColorTable01"=dword:00c77520
"ColorTable02"=dword:00058972
"ColorTable03"=dword:00859125
"ColorTable04"=dword:00241bd0
"ColorTable05"=dword:006e1bc6
"ColorTable06"=dword:000577a5
@delphym
delphym / git-undo.sh
Created June 13, 2018 02:23
Git related stuff, not even scripts, just commands
#!/bin/bash
# Script origin @ https://gist.github.com/delphym/b3598bc91d685514693f94bd495e58cc#file-git-undo-sh
## To recover all unstaged deletions at once, automatically, without specifying each single path:
git ls-files -d | xargs git checkout --
## To recover all staged deletions at once, automatically, without specifying each single path:
# git status | grep 'deleted:' | awk '{print $2}' | xargs git checkout --
@delphym
delphym / flashall.sh
Last active January 22, 2019 19:37
Random handy stuff
#!/bin/sh
## Script location: https://gist.github.com/delphym/2079545c6ba8b30e1284393812116242#file-flashall-sh
## For flashing full Android and our images to the device
AMSSROOT=AMSS
ANDROIDROOT=Android
ls -1 -I "*.txt" -I "*.md5" | awk -F'.' '{print "fastboot flash "$1" "$1"."$2}' [17:16:26]
fastboot flash dsp $AMSSROOT/adspso.bin
fastboot flash bluetooth $AMSSROOT/BTFM.bin
fastboot flash cmnlib $AMSSROOT/cmnlib.mbn
@delphym
delphym / git_retag
Created October 24, 2018 23:47 — forked from lucijafrkovic/git_retag
Retagging on git
1. list all remote tags
git ls-remote --tags
2. delete local tag
git tag -d V_1_0_1
3. push tag deletion to remote
git push origin :refs/tags/V_1_0_1
4. tag local branch again
@delphym
delphym / Bash_tipsNtricks
Last active December 14, 2018 00:39
MISC
### Howto capture regexp group and print it
ll -1
em110msp_1.0.13-10_release-unsigned.apk
em110msp_1.0.13-10_release-unsigned.json
# daniel@mcs-Ubuntu:
ls -1 | pcregrep -o2 "(.*)_(.*)_(.*)(.apk|.pom|.json)$"
1.0.13-10
1.0.13-10
### -o, --only-matching=n show only the part (#group) of the line that matched
@delphym
delphym / find_replace_recursive_regex.py
Created March 5, 2019 01:52
Recursively find and replace text in files under a specific folder with preview of changed data in dry-run mode, and optional backup.
#!/usr/bin/env python
"""
Recursively find and replace text in files under a specific folder with preview of changed data in dry-run mode.
The preview is automatically shown in `--dry-run` mode.
To also show the preview for write mode use the verbose flag, i.e. `--verbose` or `-v`.
Parameters should preferrably use single quotes, especially for the glob switch, i.e. `--glob='*.html'`.
@delphym
delphym / wincmd.ini
Last active December 20, 2022 20:30
Total Commander Theme:: Solarized Dark
[Colors]
InverseCursor=0
InverseSelection=0
BackColor=3549952
ForeColor=9868419
MarkColor=3093212
CursorColor=35253
1CursorText=-1
BackColor2=4339200
ThumbnailFrame=-2