This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[...] | |
# Alt-tab | |
bindsym Mod1+tab exec ~/.config/sway/alttab.rb | |
#[...] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'date' | |
require 'optparse' | |
require 'json' | |
require 'bundler/inline' | |
gemfile { | |
source 'https://rubygems.org' | |
gem 'mechanize' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "json" | |
require "thwait" | |
NC_ROOT = "/srv/www/vhosts/nextcloud-server/htdocs".freeze | |
NB_THREADS = 2 | |
def occ( command ) | |
`php -f #{NC_ROOT}/occ #{command}` | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
CWD=$(pwd) | |
TMP=/tmp | |
WPs_ROOT=/home/cycojesus/www | |
function update_WordPress() { | |
echo "Treating $1:" | |
echo -n " - Fixing permissions... " | |
chown -R apache:apache $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/data/data/com.termux/files/usr/bin/sh | |
# sudo for Termux | |
# For security reasons some environent variables are reset by su | |
# So need to set LD_LIBRARY_PATH again | |
# root's HOME is set to termux's home/.suroot. You can add bashrc there | |
ROOT_HOME=$HOME/.suroot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var clever_truncate = function( text, length ) { | |
if ( text.length > length ) { | |
var result = text.substring( 0, length ); | |
result = result.substring( 0, result.lastIndexOf(' ') ); | |
result += '…'; | |
return result; | |
} else { | |
return text; | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/system/xbin/bash | |
# Insipred by http://alainwolf.ch/en/tech-talk/ssh-cyanogenmod/ | |
if [ "$UID" != "0" ]; then | |
echo "This script _MUST_ be run as root" | |
exit 1 | |
fi | |
#creates /data/ssh/ if it doesn't exist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
for i in $(git submodule | sed 's|^ |_|g' | cut -d\ -f2); do | |
(cd $i; | |
git checkout master && git pull && git push | |
); | |
git commit $i -sm "updated submodule $i"; | |
done; | |
git pull && git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TennisGame: | |
def __init__(self): | |
self.finish = False | |
self.who_is_the_winner = 0 | |
self.start() | |
def start(self): | |
self.player_score = [ 0, 0 ] | |
def player_scores(self, player): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int bsearch( char to_search, char array[], int min, int max ) | |
{ | |
int middle = min + ( ( max - min ) / 2 ); | |
if ( ( min == max ) && ( array[ min ] != to_search ) ) | |
return -1; | |
if ( array[ min ] == to_search ) | |
return min; | |
if ( array[ max ] == to_search ) |