Skip to content

Instantly share code, notes, and snippets.

View fourkbomb's full-sized avatar

Simon Shields fourkbomb

View GitHub Profile
@fourkbomb
fourkbomb / lock
Created January 17, 2015 03:21
Download random xkcd and use it as screensaver
#!/bin/sh
# this requires jshon, awk and sed
if ip addr | grep wlan0 | grep UP 2>&1 >/dev/null; then
# we have wifi
URL=$(curl http://c.xkcd.com/random/comic/ --dump-header - | grep Location | awk '{print $2}' | sed 's/\r//g')
JSON=`curl "$URL"info.0.json`
wget $(echo $JSON | jshon -e img | sed 's/"//g' | sed 's/\\//g') -O $HOME/.xkcd.png
fi
i3lock -i ~/.xkcd.png -c 000000 -t

Keybase proof

I hereby claim:

  • I am fourkbomb on github.
  • I am forkbomb (https://keybase.io/forkbomb) on keybase.
  • I have a public key whose fingerprint is 4F98 1269 CD18 D0FC 9E52 5758 218B 5314 6B8C FF77

To claim this, I am signing this object:

with open('in') as f:
R, C = map(int, f.readline().split())
tramp = []
for line in f:
tramp.append(list(map(int, f.readline().split())))
q = [((0, 0))]
done = set()
while q:
cur = q.pop()
// gcc -l X11 conway.c
#include <X11/XKBlib.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="fourkbomb/android_device_samsung_i9300" path="device/samsung/i9300" remote="github" revision="cm-14.0" />
<project name="fourkbomb/android_device_samsung_smdk4412-common" path="device/samsung/smdk4412-common" remote="github" revision="cm-14.0" />
<project name="fourkbomb/android_kernel_samsung_smdk4412" path="kernel/samsung/smdk4412" remote="github" revision="cm-14.0" />
<project name="CyanogenMod/android_packages_apps_SamsungServiceMode" path="packages/apps/SamsungServiceMode" remote="github" revision="cm-13.0" />
<project name="CyanogenMod/android_hardware_samsung" path="hardware/samsung" remote="github" revision="cm-14.0" />
<project name="CyanogenMod/android_external_stlport" path="external/stlport" remote="github" revision="cm-14.0" />
<project name="fourkbomb/proprietary_vendor_samsung" path="vendor/samsung" remote="github" revision="cm-14.0" />
</manifest>
@fourkbomb
fourkbomb / switch_default_branch.py
Last active February 12, 2018 06:01
python script using requests to change the default branch for all repos owned by a user/organisation
#!/usr/bin/python
from __future__ import print_function
import requests
BRANCH = 'cm-14.1'
REPO_OWNER = 'orgs/LineageOS'
USERNAME = 'your github username'
# generate this here: https://github.com/settings/tokens
# this script only needs the 'repo' scope
{
"android_device_lge_jagnm": [
"android_device_lge_msm8226-common"
],
"android_device_lge_v410": [
"android_device_lge_v4xx-common"
],
"android_device_samsung_gts210wifi": [
"android_device_samsung_gts2-common"
],
{
"android_kernel_lge_msm8992": [
"android_device_lge_h811",
"android_device_lge_h815"
],
"android_kernel_oneplus_msm8996": [
"android_device_oneplus_oneplus3"
],
"android_kernel_htc_msm8960": [
"android_device_htc_t6spr",
@fourkbomb
fourkbomb / README.md
Last active December 22, 2018 15:11
switch from CM to Lineage non-destructively

Switch from CyanogenMod to LineageOS without redownloading everything

  1. Init the Lineage manifest: repo init -u ssh://git@github.com/LineageOS/android.git -b cm-14.1 (or cm-13.0 if you prefer that)
  2. Update your local manifest (.repo/local_manifests/roomservice.xml), if it exists - find and replace "CyanogenMod" with "LineageOS" globally.
  3. Move the git objects: mv .repo/project-objects/CyanogenMod .repo/project-objects/LineageOS
  4. curl https://gist.github.com/fourkbomb/0d94e286dc6f173eb9053c0d75e84783/raw/cc1bb94337eab5e30efa689fe1d050db25a1124a/fixlinks.sh > ~/fixlinks.sh
  5. chmod +x ~/fixlinks.sh
  6. cd .repo/projects
  7. find . -name '*.git' -exec ~/fixlinks.sh {} \;
  8. And finally, fix the actual tree:
@fourkbomb
fourkbomb / rebrand.pl
Last active December 29, 2016 05:39
rebrand.sh
#!/usr/bin/perl -ni
s/CyanogenMod/LineageOS/g unless /copyright/i;
print;
if (/Copyright/) {
s/20.+? /2017 /g;
s/CyanogenMod/LineageOS/;
s/Copyright/ /;
print;
}