Skip to content

Instantly share code, notes, and snippets.

ubuntu% nix-shell -p python310Packages.pyarrow
this derivation will be built:
/nix/store/ir34lj1izjyf7xmllapb1kgxm6pgfy2f-python3.10-pyarrow-11.0.0.drv
building '/nix/store/ir34lj1izjyf7xmllapb1kgxm6pgfy2f-python3.10-pyarrow-11.0.0.drv'...
Sourcing python-remove-tests-dir-hook
Sourcing python-catch-conflicts-hook.sh
Sourcing python-remove-bin-bytecode-hook.sh
Sourcing setuptools-build-hook
Using setuptoolsBuildPhase
Using setuptoolsShellHook
@ksalman
ksalman / shell.nix
Created March 22, 2023 17:01 — forked from cdepillabout/shell.nix
shell.nix for Python development using virtualenv and pip
let
nixpkgs-src = builtins.fetchTarball {
# master of 2021-01-05.
url = "https://github.com/NixOS/nixpkgs/archive/1a57d96edd156958b12782e8c8b6a374142a7248.tar.gz";
sha256 = "1qdh457apmw2yxbpi1biwl5x5ygaw158ppff4al8rx7gncgl10rd";
};
pkgs = import nixpkgs-src {
config = {
# allowUnfree may be necessary for some packages, but in general you should not need it.
# Instructions for fresh install
$ sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume --daemon
# reboot
$ source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
$ echo 'export NIX_PATH=darwin-config=$HOME/.nixpkgs/darwin-configuration.nix:$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH' | tee -a ~/.zshrc
$ echo 'source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh' | tee -a ~/.zshrc
$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable
$ nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin
$ nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
@ksalman
ksalman / disable-transparent-huge-pages.service
Created April 20, 2022 23:15 — forked from nicksherron/disable-transparent-huge-pages.service
systemd service for disabling Transparent Huge Pages (THP) for dbs like mongodb and redis
[Unit]
Description=Disable Transparent Huge Pages (THP)
DefaultDependencies=no
After=sysinit.target local-fs.target
Before=mongod.service
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'echo never | tee /sys/kernel/mm/transparent_hugepage/enabled > /dev/null'
### Preseed for Ubuntu 16.04.3 LTS
# Derived from: https://help.ubuntu.com/lts/installation-guide/example-preseed.txt
### Localization
# Preseeding only locale sets language, country and locale.
d-i debian-installer/locale string en_US.UTF8
d-i localechooser/supported-locales multiselect en_US.UTF-8
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/xkb-keymap select GB
@ksalman
ksalman / validate_json.sh
Created August 1, 2021 19:29 — forked from kamiller/validate_json.sh
validate json with python via bash script
echo '{"foo":"bar"}' | python -m json.tool >> /dev/null && exit 0 || echo "NOT valid JSON"; exit 1
@ksalman
ksalman / gist:569007b15f01cc725a18a27595266048
Created June 24, 2021 17:45
Thycotic Secret Server API
# Retrieve access token
curl -d "username=$TUSER&password=$TPASS&grant_type=password" -X POST $THYCOTICURL/SecretServer/oauth2/token
@ksalman
ksalman / README.md
Created February 23, 2021 22:48 — forked from reegnz/README.md
Implementing a jq REPL with fzf

Implementing a jq REPL with fzf

Update: I created jq-zsh-plugin that does this.

One of my favourite tools of my trade is jq. It essentially enables you to process json streams with the same power that sed, awk and grep provide you with for editing line-based formats (csv, tsv, etc.).

Another one of my favourite tools is fzf.

@ksalman
ksalman / tmux.dockerfile
Created September 2, 2019 19:13 — forked from spacelatte/tmux.dockerfile
i need to update actual static-docker repo but too lazy for that for now
#!/usr/bin/env docker build --compress -t pvtmert/tmux:static -f
FROM debian:stable
ENV CC clang
ENV DIR tmux-repo
ENV REPO https://github.com/tmux/tmux.git
#VOLUME /data
WORKDIR /data
@ksalman
ksalman / rpm-from-source.sh
Created May 1, 2019 18:31 — forked from fernandoaleman/rpm-from-source.sh
How to create an RPM from source with spec file
# How to create an RPM from source with spec file
# This is for Redhat versions of linux. Sometimes when you search for an rpm package,
# it is either outdated or not available. The only thing available is the source code.
# You can create a custom RPM package from source.
#
# For this example, I'll be using the latest version of Git, currently v.1.7.7.3
# Step: 1
# Install rpmbuild