Skip to content

Instantly share code, notes, and snippets.

@maximusfox
maximusfox / Commands
Created June 9, 2021 14:21 — forked from FZX/Commands
Terminal commands. Change Cinnamon theme from terminal. Disable cursor blink from terminal. Disabling recent files history from terminal. Setup proxy file with command.
gsettings set org.cinnamon.desktop.privacy remember-recent-files false
gsettings set org.cinnamon.theme name "Mint-Y-Dark"
gsettings set org.cinnamon.desktop.interface gtk-theme "Mint-Y-Dark"
gsettings set org.cinnamon.desktop.wm.preferences theme "Mint-Y-Dark"
gsettings set org.cinnamon.desktop.interface cursor-blink false
gsettings set org.gnome.system.proxy autoconfig-url "http://mediahint.com/default.pac"
gsettings set org.gnome.system.proxy mode auto
gsettings set org.cinnamon enabled-applets "['panel1:left:0:[email protected]:0', 'panel1:left:2:[email protected]:2', 'panel1:left:3:[email protected]:3', 'panel1:right:0:[email protected]:4', 'panel1:right:1:[email protected]:5', 'panel1:right:2:[email protected]:6', 'panel1:right:3:[email protected]:7', 'panel1:right:11:[email protected]:1', 'panel1:right:5:[email protected]:9', 'panel1:right:6:[email protected]:10', 'panel1:right:7:[email protected]:11', 'panel1:right:8:[email protected]:12', '
@maximusfox
maximusfox / web-servers.md
Created May 15, 2021 12:17 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@maximusfox
maximusfox / README.md
Created May 15, 2021 12:17 — forked from joyrexus/README.md
Perl one-liners

Hi:

perl -e 'print "hello world!\n"'

A simple filter:

perl -ne 'print if /REGEX/'

Filter out blank lines (in place):

@maximusfox
maximusfox / succ.py
Created July 14, 2020 16:07
Python string incrementation like in Ruby
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import string
def succ(s):
if not isinstance(s, (str, string)):
raise TypeError("succ works only with strings")
if not s: return
abandoned
able
absolute
academic
acceptable
acclaimed
accomplished
accurate
ace
aching
@maximusfox
maximusfox / animals.txt
Last active June 7, 2020 19:36 — forked from Bradleykingz/animals.txt
Alphabetized, removed all occurrences of 'list'
aardvark
aardwolf
albatross
alligator
alpaca
amphibian
anaconda
angelfish
anglerfish
ant
a = [1,2,3,4,5]
# 2 new arrays
left,right = a.each_slice( (a.size/2.0).round ).to_a
# left == [1, 2, 3]
# right == [4, 5]
# make array 2-dimensional
a.each_slice( (a.size/2.0).round ).to_a
# a == [[1, 2, 3], [4, 5]]
@maximusfox
maximusfox / Web.pm
Last active May 12, 2020 23:02
Async sockets file downloading example in Perl (don't work on Windows)
# Just example about work with HTTP
package Web;
use strict;
use IO::Socket::INET;
use IO::Socket::SSL;
use Carp qw(croak);
use MIME::Base64 qw(encode_base64);
@maximusfox
maximusfox / diff.cs
Last active June 21, 2019 22:23
ImageMagick.NET calc different pixels count
using ImageMagick;
var image1Path = @"{-Project.Directory-}\ScreenStamps\1.bmp";
var image2Path = @"{-Project.Directory-}\ScreenStamps\2.bmp";
var diffImagePath = @"{-Project.Directory-}\imageDIFF.png";
using (ImageMagick.MagickImage image1 = new ImageMagick.MagickImage(image1Path))
using (ImageMagick.MagickImage image2 = new ImageMagick.MagickImage(image2Path))
{
@maximusfox
maximusfox / GetThreadStack0.cs
Created March 23, 2017 15:45 — forked from baratgabor/GetThreadStack0.cs
32 bit ThreadStack0 implementation in C#
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
/// <summary>
/// Only for 32 bit processes. The methods of this static class can find the special symbol ThreadStack0,
/// and follow pointer chains to return the end result in the specified type T.