Skip to content

Instantly share code, notes, and snippets.

View neumachen's full-sized avatar
🏠
Working from home

Kareem H neumachen

🏠
Working from home
  • Bergen, Norway
  • 01:01 (UTC -12:00)
View GitHub Profile
@neumachen
neumachen / assets.rake
Created October 27, 2018 23:41 — forked from guilleiguaran/assets.rake
Fixed rake assets:precompile task
desc "Compile all the assets named in config.assets.precompile"
task :precompile do
# We need to do this dance because RAILS_GROUPS is used
# too early in the boot process and changing here is already too late.
if ENV["RAILS_GROUPS"].to_s.empty? || ENV["RAILS_ENV"].to_s.empty?
ENV["RAILS_GROUPS"] ||= "assets"
ENV["RAILS_ENV"] ||= "production"
Kernel.exec $0, *ARGV
else
Rake::Task["environment"].invoke
@neumachen
neumachen / query.sql
Created October 29, 2018 15:50 — forked from ramiroaznar/query.sql
How to find duplicate values with PostgreSQL
select * from table t1
where (select count(*) from table t2
where t1.field = t2.field) > 1
order by field
//
// Variables
// --------------------------------------------------
// Variables directly translating Bootstrap variables
// -------------------------
$s2bs-border-radius-base: $border-radius !default;
$s2bs-border-radius-large: $border-radius-lg !default;
$s2bs-border-radius-small: $border-radius-sm !default;
@neumachen
neumachen / logging.bash
Created February 1, 2019 01:51 — forked from goodmami/logging.bash
Basic logging commands for Linux shell scripts
#!/bin/bash
##
## Simple logging mechanism for Bash
##
## Author: Michael Wayne Goodman <goodman.m.w@gmail.com>
## Thanks: Jul for the idea to add a datestring. See:
## http://www.goodmami.org/2011/07/simple-logging-in-bash-scripts/#comment-5854
## Thanks: @gffhcks for noting that inf() and debug() should be swapped,
## and that critical() used $2 instead of $1
@neumachen
neumachen / kitty.conf
Created March 7, 2019 03:27 — forked from NeoTheFox/kitty.conf
kitty config with solarized dark theme
# vim:fileencoding=utf-8:ft=conf
# Font family. You can also specify different fonts for the
# bold/italic/bold-italic variants. By default they are derived automatically,
# by the OSes font system. Setting them manually is useful for font families
# that have many weight variants like Book, Medium, Thick, etc. For example:
# font_family Operator Mono Book
# bold_font Operator Mono Thick
# bold_italic_font Operator Mono Medium
font_family Hack
@neumachen
neumachen / yankring.vim
Created June 26, 2019 00:33 — forked from milisims/yankring.vim
A simple yankring. A much needed improvement on the numbered registers.
function! yankring#reset() abort
let s:yankring = []
for l:i in range(1, 9)
execute 'let l:contents = @' . l:i
call add(s:yankring, l:contents)
endfor
endfunction
call yankring#reset()
function! yankring#yank(contents) abort
@neumachen
neumachen / real.py
Created July 12, 2019 20:57 — forked from alfredodeza/real.py
Real time subprocess stdout/stderr
import logging
import threading
import os
import subprocess
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
class LogPipe(threading.Thread):
@neumachen
neumachen / channel_example_test.go
Created July 21, 2019 16:51 — forked from casualjim/channel_example_test.go
examples of golang context and channels
package channel
import (
"fmt"
"sync"
"time"
)
func ExampleUnbufferedSend() {
c1 := make(chan string)
@neumachen
neumachen / backup_all_docker_images.sh
Created July 24, 2019 18:55 — forked from ricardomiguelfaria/backup_all_docker_images.sh
A bash script to backup all docker images to files
#!/usr/bin/sh
if [[ $# -eq 0 ]]; then
echo "Usage: $0 <backup_dir>"
exit
fi
destination=$1
if ! type "pv" > /dev/null; then
echo 'pv' command not found on your system, install it to get a nice progress indicator...
else