This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
qemu-system-i386 -L /Applications/UTM.app/Contents/Resources/qemu -S -spice unix=on,addr=[REDACTED],disable-ticketing=on,image-compression=off,playback-compression=off,streaming-video=off,gl=off -chardev spiceport,name=org.qemu.monitor.qmp.0,id=org.qemu.monitor.qmp -mon chardev=org.qemu.monitor.qmp,mode=control -nodefaults -vga none -device rtl8139,mac=[REDACTED],netdev=net0 -netdev vmnet-shared,id=net0 -device qxl-vga -smp cpus=1,sockets=1,cores=1,threads=1 -machine pc,vmport=off,hpet=off -accel tcg,tb-size=128 -global PIIX4_PM.disable_s3=1 -global ICH9-LPC.disable_s3=1 -m 512 -audiodev spice,id=audio0 -device sb16,audiodev=audio0 -device ide-cd,bus=ide.0,unit=0,drive=drive[REDACTED],bootindex=0 -drive if=none,media=cdrom,id=drive[REDACTED],readonly=on -device ide-hd,bus=ide.0,unit=1,drive=drive[REDACTED],bootindex=1 -drive "if=none,media=disk,id=drive[REDACTED],file.filename=[REDACTED]/Windows 98.utm/Data/[REDACTED].qcow2,discard=unmap,detect-zeroes=unmap" -device virtio-serial -device virtserialport,charde |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"sync" | |
"time" | |
) | |
func main() { | |
buffers := make(chan bool, 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
charges.country AS country, | |
charges.amount AS percentage_mrr, | |
messages_exchanged * 100 / ( | |
SELECT SUM(conversations.messages_exchanged) | |
FROM ( | |
SELECT | |
cards.country AS country, | |
SUM(charges.amount) / | |
( SELECT SUM(charges.amount) / 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo fallocate -l 4G /swapfile | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
echo "/swapfile none swap sw 0 0" >> /etc/fstab | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Include this concern with each model using a Hstore. It then makes it possible | |
# to use more easily this feature. To make sure everything works smoothly, | |
# use a migration equivalent to this one : | |
# | |
# t.hstore :data, null: false, default: {} | |
# | |
module Concerns::Hashable | |
extend ActiveSupport::Concern | |
# Public : This method adds data to the model using the Hash supplied. It is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Store < ActiveRecord::Base | |
include Concerns::Hashable | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
store = Store.last | |
store.set(first_name: "Ron") | |
# => #<Store....> | |
# Il est possibler d'enchaîner les méthodes | |
store.set(first_name: "Ron").set(lastt_name: "Swanson") | |
# => #<Store....> | |
store.set(first_name: "Ron", last_name: "Swanson").del(:gender) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
store = Store.create(data: { first_name: "Ron" }) | |
store.data["first_name"] = "Tom" | |
data_will_change! | |
store.save | |
store.data["first_name"] => # "Tom" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
store = Store.create(data: { first_name: "Ron" }) | |
store.data["first_name"] = "Tom" | |
store.save | |
store.data["first_name"] => # "Ron" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Store.create(type: "people", data: { first_name: "Ron", last_name: "Swanson", age: 43 }) | |
Store.last.data["last_name"] # => "Swanson" |
NewerOlder