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
**************************************************************************** | |
**** FaunaDB Relations: GraphQL schemas, mutations and resulting documents * | |
**************************************************************************** | |
**** One to One Relation *************************************************** | |
SCHEMA: | |
type User { name: String! car: Car } | |
type Car { plate: String! owner: User } | |
MUTATION: | |
mutation Create { | |
createUser(data: { |
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
1. Open terminal inside your virtual machine and run: | |
sudo dd if=/dev/zero of=EMPTY bs=1M | |
sudo rm ./EMPTY | |
This will zeroify all the empty blocks on your disk. | |
2. Shutdown you virtual box. | |
3. Check what type of virtual drive do you have: VMDK or VDI. VirtualBox shrinking works only with VDI files. | |
If you have a VDI file, proceed to the last step, otherwise you'll need to perform an additional step of converting your VMDK file |
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
import java.io.IOException | |
import java.nio.ByteBuffer | |
import java.nio.channels.{AsynchronousFileChannel, CompletionHandler} | |
import java.nio.file.Paths | |
import java.nio.file.StandardOpenOption._ | |
import scala.concurrent.{ExecutionContext, Future, Promise} | |
import scala.util.Try | |
/** |
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
Remove: | |
touch .hushlogin | |
Get it back: | |
rm .hushlogin |
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
import java.net.{ InetSocketAddress, Socket } | |
import java.time.Duration | |
import java.time.temporal.ChronoUnit.SECONDS | |
import java.util.concurrent.{ TimeUnit, TimeoutException } | |
import java.util.function.{ Consumer, Predicate } | |
import com.dimafeng.testcontainers.{ Container, GenericContainer } | |
import com.faunadb.client.FaunaClient | |
import org.junit.runner.Description |
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
1. | |
Paste it to the bash: | |
git config --global alias.lg "log --graph --pretty=format:'%C(auto)%h -%d %s %Cgreen(%cr) %C(bold blue)%an <%ae>%Creset' --abbrev-commit" | |
2. | |
Then in any git repo type: git lg | |
3. | |
Enjoy |
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
1. | |
# vim /etc/sysctl.conf | |
fs.file-max = 999999 | |
net.ipv4.tcp_rmem = 4096 4096 16777216 | |
net.ipv4.tcp_wmem = 4096 4096 16777216 | |
net.ipv4.ip_local_port_range = 1024 65535 | |
2. | |
# vim /etc/security/limits.conf | |
root - nofile 999999 |
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
cd /proc/<pid> && echo -n "Max open files=65535:65535" > limits |
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
require 'rubygems' | |
require 'aws-sdk' | |
puts "\nLoading instances..." | |
if File.exist?('instances.yaml') | |
instances_by_id = YAML.load_file('instances.yaml') | |
puts "Loaded %d instances from instances.yaml" % [instances_by_id.count] | |
else | |
instances_by_id = Hash.new | |
ec2 = AWS::EC2.new |
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
# Nginx - logrotate & upload to S3 | |
0 0 * * * /usr/sbin/logrotate /etc/logrotate.d/nginx | |
15 0 * * * s3cmd put /var/log/nginx/access.log-`date +"\%Y\%m\%d"`.gz s3://$LOGS_BUCKET_NAME/nginx-access/`date +"dt=\%Y\%m\%d"`/`hostname -s`.access.log-`date +"\%Y\%m\%d"`.gz |
NewerOlder