Skip to content

Instantly share code, notes, and snippets.

View milisarge's full-sized avatar

Milis Linux milisarge

View GitHub Profile
@milisarge
milisarge / static-tar.sh
Last active February 1, 2022 19:45
GNU tar static build
#!/bin/bash
#
# build static tar because we need exercises in minimalism
# MIT licentar: google it or see robxu9.mit-license.org.
# https://github.com/luciusmagn/tar-static/
# For Linux, also builds musl for truly static linking.
tar_version="1.34"
musl_version="1.2.2"
@milisarge
milisarge / multiple-tmux.sh
Last active December 29, 2021 07:02
Tmux shells from script
#!/bin/sh
tmux new-session -d -s work1 'cd a/b/c'; # start new detached tmux session, run htop
tmux split-window; # split the detached tmux session
tmux send 'cd /d/e/f' ENTER; # send 2nd command 'htop -t' to 2nd pane. I believe there's a `--target` option to target specific pane.
#tmux a;
tmux new-session -d -s work2 'htop';
# default vertical / -h horizontal
tmux split-window -h;
tmux send 'a/b/c/myscript.sh' ENTER;
tmux a;
@milisarge
milisarge / linq.lua
Created December 8, 2021 13:56
Language Integrated Query impl in Lua
--
-- linq.lua
--
-- Copyright (c) 2020 Mathew Mariani
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy of
-- this software and associated documentation files (the "Software"), to deal in
-- the Software without restriction, including without limitation the rights to
-- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-- of the Software, and to permit persons to whom the Software is furnished to do
@milisarge
milisarge / lxc-static-ip.config
Last active December 4, 2021 10:37
LXC static ip config
# Template used to create this container: /usr/share/lxc/templates/lxc-download
# Parameters passed to the template: -d alpine -r edge -a amd64
# Template script checksum (SHA-1): 985e49018f4037a7854e89877ba09c4fe6c57af5
# For additional config options, please look at lxc.container.conf(5)
# Uncomment the following line to support nesting containers:
#lxc.include = /usr/share/lxc/config/nesting.conf
# (Be aware this has security implications)
# Uncomment to create unprivileged containers
@milisarge
milisarge / canvas-production-deploy-debian.md
Last active April 13, 2022 07:54
Canvas-LMS Kurulum Notlar

İşletim Sistemi bilgileri

Debian Bullseye LXC

Ön-gerekler

apt install wget git lxc file
# file komutu Canvas koşuğunda gereklidir.
@milisarge
milisarge / pam.py
Created December 1, 2021 10:35
One file python pam module
# (c) 2007 Chris AtLee <chris@atlee.ca>
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
#
# Original author: Chris AtLee
#
# Modified by David Ford, 2011-12-6
# added py3 support and encoding
# added pam_end
# added pam_setcred to reset credentials after seeing Leon Walker's remarks
@milisarge
milisarge / ayguci-cli.py
Created December 1, 2021 10:34
Ayguci sudo ile erişim
import subprocess
import pam
sifre="1234567"
kullanici="myuser"
p=pam.pam()
durum=p.authenticate(kullanici,sifre)
@milisarge
milisarge / canvas-production-deploy.md
Last active December 1, 2021 12:37
Canvas-LMS Kurulum Notları

İşletim Sistemi bilgileri

Ubuntu 20.04.2 LTS

Veritabanı kurulması ve ayarları

sudo apt-get install postgresql
# db şifre set edilecek
sudo -u postgres createuser canvas --no-createdb --no-superuser --no-createrole --pwprompt
@milisarge
milisarge / systray.vala
Created September 8, 2017 14:24
Systray example in vala
using Gtk;
public class Main {
class AppStatusIcon : Window {
private StatusIcon trayicon;
private Gtk.Menu menuSystem;
private AboutDialog aboutDialog;
public AppStatusIcon() {
/* Create tray icon */
import httpclient, asyncdispatch, strutils, tables, unicode, json, math, times
const
ForecastUrlFormat = "http://api.openweathermap.org/data/2.5/forecast/daily?APPID=$1&lang=en&q=$2&cnt=$3"
ResultFormat = """$1:
$2
Temperature: $3 °C
Humidity: $4%
Clouds: $5%