Skip to content

Instantly share code, notes, and snippets.

View aspyct's full-sized avatar

Antoine d'Otreppe aspyct

View GitHub Profile
@aspyct
aspyct / gist:79666f7d1bc3472ffeb9d8e60ba49ff8
Created April 26, 2020 19:15
Ubuntu server expand lvm root volume
$ sudo lvm
lvm> lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
Size of logical volume ubuntu-vg/ubuntu-lv changed from 4.00 GiB (1024 extents) to 110.78 GiB (28360 extents).
Logical volume ubuntu-vg/ubuntu-lv successfully resized.
lvm> exit
Exiting.
$ sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/ubuntu-vg/ubuntu-lv is mounted on /; on-line resizing required
@aspyct
aspyct / query.sql
Last active February 25, 2020 12:54
Postgres database inspection queries
-- List big tables, materialized views and indices
SELECT relname AS objectname
, relkind AS objecttype
, reltuples AS entries
, pg_size_pretty(pg_table_size(oid)) AS size
FROM pg_class
WHERE relkind IN ('r', 'i', 'm')
ORDER BY pg_table_size(oid) DESC
LIMIT 10;
@aspyct
aspyct / README.md
Last active October 29, 2019 21:05

Add this layout section to the symbols file, after the "bepo" entry. Apply the layout for each login with:

setxkbmap -layout fr -variant bepo_aspyct

Or if you modified the evdev.xml file, you can directly select the layout from Gnome. Tested on Ubuntu 19.10, YMMV.

@aspyct
aspyct / rsyslog.conf
Created October 25, 2019 12:09
rsyslog config to discard syslog messages with tag `fluentd`
# Put this before the other matching rules.
# Discard anything from fluentd
:syslogtag, isequal, "fluentd:" /dev/null
& stop
@aspyct
aspyct / check_server.sh
Created June 25, 2012 14:31
Perl & Bash scripts to warn you if your website is failing
#!/bin/bash
# Actual recipient and sender are defined in another file
script_dir=`dirname $0`;
script_name=`basename $0`;
config_file="$script_dir/config-$script_name";
if [ -f $config_file ]; then
source $config_file;
else
@aspyct
aspyct / slow_regex.pl
Created December 22, 2014 13:40
Perl killer
# http://swtch.com/~rsc/regexp/regexp1.html
$_ = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
if ( m/a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ ) {
print "hello";
}
public static class BundleExtensions
{
const string SERIALIZED_KEY = "__JSONSERIALIZED__";
static List<IMapItem> typesMapping;
//TODO: put in order of preference (cf string/charseq , serializable/parcelable, ...) because the for loop will stop at the first recognized type
static BundleExtensions() {
typesMapping = new List<IMapItem>{
new TypeMap<IBinder> ((b, i, v) => b.PutBinder(i, v), (b, i) => b.GetBinder(i)),
@aspyct
aspyct / heap.rb
Created August 22, 2012 19:42
Binomial heap (priority queue) implementation in ruby
class Heap
def initialize
# @elements is an array representing the tree
# for each i:
# parent => @elements[i / 2]
# left => @elements[i * 2]
# right => @elements[i * 2 + 1]
@elements = []
end
@aspyct
aspyct / Project.Core.csproj
Created April 13, 2017 19:48
Enable debugging in .netstandard libraries for Xamarin
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugType>Full</DebugType>
+ </PropertyGroup>
@aspyct
aspyct / Project.Droid.csproj
Created April 13, 2017 18:10
Increase java heap size while deploying Xamarin.Android project on device
+ <PropertyGroup>
+ <JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
+ </PropertyGroup>